home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1998 August / macformat-066.iso / Shareware Plus / Development / Object Plant 1.5 / 68k Object Plant / 68k Object Plant.rsrc / TEXT_128_EPS prep.txt < prev    next >
Encoding:
Text File  |  1998-04-18  |  56.2 KB  |  2,218 lines

  1.  
  2. /RE
  3. {
  4.     findfont begin
  5.     currentdict dup length dict begin
  6.     {
  7.         1 index /FID ne {def}{pop pop}ifelse
  8.     }forall
  9.     /FontName exch def dup length 0 ne
  10.     {
  11.         /Encoding Encoding 256 array copy def
  12.         0 exch
  13.         {
  14.             dup type /nametype eq
  15.             {
  16.                 Encoding 2 index 2 index put
  17.                 pop 1 add
  18.             }
  19.             {
  20.                 exch pop
  21.             }ifelse
  22.         }forall
  23.     }if pop
  24.     currentdict dup end end
  25.     /FontName get exch definefont pop
  26. } bind def
  27.  
  28. /stdencoding [
  29. 39/quotesingle 96/grave 128/Adieresis/Aring/Ccedilla/Eacute/Ntilde/Odieresis
  30. /Udieresis/aacute/agrave/acircumflex/adieresis/atilde/aring/ccedilla/eacute
  31. /egrave/ecircumflex/edieresis/iacute/igrave/icircumflex/idieresis/ntilde
  32. /oacute/ograve/ocircumflex/odieresis/otilde/uacute/ugrave/ucircumflex
  33. /udieresis/dagger/degree/cent/sterling/section/bullet/paragraph/germandbls
  34. /registered/copyright/trademark/acute/dieresis/.notdef/AE/Oslash
  35. /.notdef/plusminus/.notdef/.notdef/yen/mu/.notdef/.notdef
  36. /.notdef/.notdef/.notdef/ordfeminine/ordmasculine/.notdef/ae/oslash
  37. /questiondown/exclamdown/logicalnot/.notdef/florin/.notdef/.notdef
  38. /guillemotleft/guillemotright/ellipsis/.notdef/Agrave/Atilde/Otilde/OE/oe
  39. /endash/emdash/quotedblleft/quotedblright/quoteleft/quoteright/divide
  40. /.notdef/ydieresis/Ydieresis/fraction/currency/guilsinglleft/guilsinglright
  41. /fi/fl/daggerdbl/periodcentered/quotesinglbase/quotedblbase/perthousand
  42. /Acircumflex/Ecircumflex/Aacute/Edieresis/Egrave/Iacute/Icircumflex
  43. /Idieresis/Igrave/Oacute/Ocircumflex/.notdef/Ograve/Uacute/Ucircumflex
  44. /Ugrave/dotlessi/circumflex/tilde/macron/breve/dotaccent/ring/cedilla
  45. /hungarumlaut/ogonek/caron
  46. ] def
  47. stdencoding /_Helvetica /Helvetica RE
  48. stdencoding /_Helvetica-Oblique /Helvetica-Oblique RE
  49. stdencoding /_Helvetica-Bold /Helvetica-Bold RE
  50. stdencoding /_Helvetica-BoldOblique /Helvetica-BoldOblique RE
  51.  
  52. /Monaco10 /_Helvetica findfont 10 scalefont def
  53. /MonacoI10 /_Helvetica-Oblique findfont 10 scalefont def
  54. /MonacoB10 /_Helvetica-Bold findfont 10 scalefont def
  55. /MonacoBI10 /_Helvetica-BoldOblique findfont 10 scalefont def
  56. /Monaco9 /_Helvetica findfont 9 scalefont def
  57. /MonacoI9 /_Helvetica-Oblique findfont 9 scalefont def
  58.  
  59. /defaultHeight 30 def /ifDefaultHeight 40 def /defaultWidth 60 def
  60. /pointSize 3 def /diamondWidth 8 def /pyramidWidth 18 def
  61. /eventBoxWidth 9 def
  62.  
  63. /drawClassBox    % oper1 ... opern noOfOpers attr1 ... attrn noOfAttrs name abstract nested
  64. {
  65.     50 dict begin
  66.     /nested exch def /abstract exch def
  67.     /name exch def
  68.  
  69.     false abstract eq { MonacoB10 setfont }{ MonacoBI10 setfont } ifelse
  70.  
  71.     /maxwidth name stringwidth pop def
  72.     /boxwidth defaultWidth def
  73.  
  74.     /noOfAttr exch def /AttrArray noOfAttr array def /index noOfAttr 1 sub def {
  75.         index -1 eq { exit } if
  76.         AttrArray index 3 -1 roll put
  77.         /index index 1 sub def
  78.     } loop
  79.  
  80.     /noOfOper exch def /OperArray noOfOper array def /index noOfOper 1 sub def {
  81.         index -1 eq { exit } if
  82.         OperArray index 3 -1 roll put
  83.         /index index 1 sub def
  84.     } loop
  85.  
  86.     % Set font size for attributes an operations while checking boxwidth
  87.     false abstract eq { Monaco9 setfont }{ MonacoI9 setfont } ifelse
  88.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  89.     AttrArray {
  90.         stringwidth pop 8 add dup
  91.         maxwidth gt { /maxwidth exch def }{ pop } ifelse
  92.     } forall
  93.     OperArray {
  94.         stringwidth pop 8 add dup
  95.         maxwidth gt { /maxwidth exch def }{ pop } ifelse
  96.     } forall
  97.  
  98.     % Set back font size for the class name
  99.     false abstract eq { MonacoB10 setfont }{ MonacoBI10 setfont } ifelse
  100.     maxwidth boxwidth 6 sub gt { /boxwidth maxwidth 6 add def } if
  101.     noOfAttr 0 ne { /boxheight noOfAttr 12 mul 26 add def } if
  102.     noOfOper 0 ne { noOfAttr 0 ne { /boxheight boxheight 6 add noOfOper 12 mul add def }
  103.                                     { /boxheight noOfOper 12 mul 26 add def } ifelse } if
  104.     noOfOper 0 eq { noOfAttr 0 eq { /boxheight defaultHeight def } if } if
  105.     boxheight defaultHeight lt { /boxheight defaultHeight def } if
  106.     nested true eq { [3] 0 setdash } if
  107.     currentpoint boxwidth 0 rlineto
  108.     0 boxheight neg rlineto
  109.     boxwidth neg 0 rlineto closepath gsave 1 setgray fill grestore stroke
  110.     nested true eq { [] 0 setdash } if
  111.  
  112.     noOfAttr 0 ne { leftmargin topmargin -18 add moveto boxwidth 0 rlineto stroke } if
  113.  
  114.     noOfOper 0 ne
  115.     {
  116.         newpath noOfAttr 0 ne { leftmargin topmargin -24 add noOfAttr -12 mul add moveto }
  117.                                     { leftmargin topmargin -20 add moveto }ifelse
  118.         boxwidth 0 rlineto stroke
  119.     }if
  120.     moveto currentpoint
  121.     boxwidth name stringwidth pop sub 2 div -14 rmoveto name show
  122.  
  123.     false abstract eq { Monaco9 setfont }{ MonacoI9 setfont } ifelse
  124.     currentpoint /index 0 def
  125.     AttrArray
  126.     { 
  127.         leftmargin 8 add topmargin moveto
  128.         0 -12 index mul -30 add rmoveto show
  129.         /index index 1 add def
  130.     } forall
  131.     moveto currentpoint /index 0 def
  132.     OperArray
  133.     {
  134.         leftmargin 8 add topmargin moveto
  135.         noOfAttr 0 ne { 0 -12 index mul noOfAttr -12 mul add 38 sub rmoveto }
  136.         { 0 -12 index mul 32 sub rmoveto }ifelse show
  137.          /index index 1 add def
  138.     } forall
  139.     leftmargin boxwidth add topmargin boxheight sub
  140.     end
  141. } def
  142. /drawInterfaceBox    % oper1 ... opern noOfOpers attr1 ... attrn noOfAttrs name drawInterfaceBox
  143. {
  144.     50 dict begin
  145.     /name exch def
  146.  
  147.     MonacoB10 setfont
  148.  
  149.     /maxwidth name stringwidth pop def
  150.     /boxwidth defaultWidth def
  151.  
  152.     /noOfAttr exch def /AttrArray noOfAttr array def /index noOfAttr 1 sub def {
  153.         index -1 eq { exit } if
  154.         AttrArray index 3 -1 roll put
  155.         /index index 1 sub def
  156.     } loop
  157.  
  158.     /noOfOper exch def /OperArray noOfOper array def /index noOfOper 1 sub def {
  159.         index -1 eq { exit } if
  160.         OperArray index 3 -1 roll put
  161.         /index index 1 sub def
  162.     } loop
  163.  
  164.     % Set font size for attributes an operations while checking boxwidth
  165.     Monaco9 setfont
  166.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  167.     AttrArray {
  168.         stringwidth pop 8 add dup
  169.         maxwidth gt { /maxwidth exch def }{ pop } ifelse
  170.     } forall
  171.     OperArray {
  172.         stringwidth pop 8 add dup
  173.         maxwidth gt { /maxwidth exch def }{ pop } ifelse
  174.     } forall
  175.  
  176.     MonacoB10 setfont
  177.     maxwidth boxwidth 6 sub gt { /boxwidth maxwidth 6 add def } if
  178.     noOfAttr 0 ne { /boxheight noOfAttr 12 mul 36 add def } if
  179.     noOfOper 0 ne { noOfAttr 0 ne { /boxheight boxheight 6 add noOfOper 12 mul add def }
  180.                                     { /boxheight noOfOper 12 mul 36 add def } ifelse } if
  181.     noOfOper 0 eq { noOfAttr 0 eq { /boxheight ifDefaultHeight def } if } if
  182.     boxheight ifDefaultHeight lt { /boxheight ifDefaultHeight def } if
  183.     currentpoint boxwidth 0 rlineto
  184.     0 boxheight  neg  rlineto
  185.     boxwidth neg 0 rlineto closepath gsave 1 setgray fill grestore stroke
  186.  
  187.     noOfAttr 0 ne { leftmargin topmargin -28 add moveto boxwidth 0 rlineto stroke } if
  188.  
  189.     noOfOper 0 ne
  190.     {
  191.         newpath noOfAttr 0 ne { leftmargin topmargin -34 add noOfAttr -12 mul add moveto }
  192.                                     { leftmargin topmargin -28 add moveto }ifelse
  193.         boxwidth 0 rlineto stroke
  194.     }if
  195.     moveto currentpoint
  196.     boxwidth name stringwidth pop sub 2 div -24 rmoveto name show
  197.     leftmargin topmargin moveto
  198.     boxwidth (¬´interface¬ª) stringwidth pop sub 2 div -14 rmoveto (¬´interface¬ª) show
  199.  
  200.     Monaco9 setfont
  201.     currentpoint /index 0 def
  202.     AttrArray
  203.     { 
  204.         leftmargin 8 add topmargin 10 sub moveto
  205.         0 -12 index mul -30 add rmoveto show
  206.         /index index 1 add def
  207.     } forall
  208.     moveto currentpoint /index 0 def
  209.     OperArray
  210.     {
  211.         leftmargin 8 add topmargin 10 sub moveto
  212.         noOfAttr 0 ne { 0 -12 index mul noOfAttr -12 mul add 38 sub rmoveto }
  213.         { 0 -12 index mul 32 sub rmoveto }ifelse show
  214.          /index index 1 add def
  215.     } forall
  216.     leftmargin boxwidth add topmargin boxheight sub
  217.     end
  218. } def
  219.  
  220. /arrowdict 15 dict def
  221. arrowdict begin
  222. /mtrx matrix def
  223. end
  224.  
  225. /drawArrow %     tailx taily tipx tipy halfthickness halfheadthickness headlength dashed filled drawArrow
  226. { arrowdict begin
  227.     /filled exch def
  228.     /dashed exch def
  229.     /headlength exch def
  230.     /halfheadthickness exch 2 div def
  231.     /halfthickness exch 2 div def
  232.     /tipy exch def /tipx exch def
  233.     /taily exch def /tailx exch def
  234.  
  235.     /dx tipx tailx sub def
  236.     /dy tipy taily sub def
  237.     /arrowlength dx dx mul dy dy mul add sqrt def
  238.     /angle dy dx atan def
  239.     /arrowlength arrowlength headlength add def
  240.     /base arrowlength headlength sub def
  241.     /savematrix mtrx currentmatrix def
  242.     tailx taily translate
  243.     angle rotate
  244.     base halfthickness neg moveto
  245.     base halfheadthickness neg lineto
  246.     arrowlength 0 lineto
  247.     base halfheadthickness lineto
  248.     base halfthickness lineto
  249.     closepath
  250.     filled true eq { fill }{ gsave 1 setgray fill grestore stroke } ifelse
  251.     savematrix setmatrix
  252.     newpath 1 setlinewidth
  253.     tailx taily translate
  254.     angle rotate
  255.     dashed true eq { [3] 0 setdash }if
  256.     0 0 moveto base 0 lineto stroke
  257.     dashed true eq { [] 0 setdash }if
  258.     savematrix setmatrix
  259.     end
  260. } def
  261.  
  262. /navarrowdict 15 dict def
  263. navarrowdict begin
  264. /mtrx matrix def
  265. end
  266.  
  267. /drawNavArrow %     tailx taily tipx tipy halfthickness halfheadthickness headlength dashed drawNavArrow
  268. { navarrowdict begin
  269.     /dashed exch def
  270.     /headlength exch def
  271.     /halfheadthickness exch 2 div def
  272.     /halfthickness exch 2 div def
  273.     /tipy exch def /tipx exch def
  274.     /taily exch def /tailx exch def
  275.  
  276.     /dx tipx tailx sub def
  277.     /dy tipy taily sub def
  278.     /arrowlength dx dx mul dy dy mul add sqrt halfthickness sub def
  279.     /angle dy dx atan def
  280.     /base arrowlength headlength sub def
  281.     /savematrix mtrx currentmatrix def
  282.     tailx taily translate
  283.     angle rotate
  284.     base halfheadthickness neg moveto
  285.     arrowlength 0 lineto
  286.     base halfheadthickness lineto
  287.     0 setgray stroke
  288.     savematrix setmatrix
  289.     newpath 1 setlinewidth
  290.     tailx taily translate
  291.     angle rotate
  292.     dashed true eq { [3] 0 setdash }if
  293.     0 0 moveto arrowlength 0 lineto stroke
  294.     dashed true eq { [] 0 setdash }if
  295.     savematrix setmatrix
  296.     end
  297. } def
  298.  
  299. /drawAssoc    % pointn ... point1 noOfPoints branchRole branchMultText branchMult branchQualPos branchQual branchNavi baseRole baseMultText baseMult baseQualPos baseQual baseNavi name
  300. {
  301.     50 dict begin
  302.     Monaco9 setfont
  303.  
  304.     /name exch def /baseNavi exch def /baseQual exch def /baseQualPos exch def /baseMult exch def /baseMultText exch def /baseRole exch def
  305.     /branchNavi exch def /branchQual exch def /branchQualPos exch def /branchMult exch def /branchMultText exch def /branchRole exch def
  306.     /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def
  307.     {
  308.         index noOfPoints 2 mul eq { exit } if
  309.         pntArray index 3 -1 roll put
  310.         /index index 1 add def
  311.     } loop
  312.  
  313. % Get the base qualifier's position
  314.     
  315.     /baseQualTW baseQual stringwidth pop def
  316.     /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  317.     /p1.v pntArray noOfPoints 1 sub 2 mul get def
  318.     /connect.h p1.h def
  319.     /connect.v p1.v def
  320.     baseQualPos 1 eq
  321.     {    % to the left of the first point
  322.         baseMult 1 eq {
  323.             /connect.h connect.h pointSize 2 div 2 add add def
  324.         } if
  325.         baseMult 2 eq {
  326.             /connect.h connect.h pointSize 2 div 2 add add def
  327.         } if
  328.     } if
  329.     baseQualPos 2 eq
  330.     {    % above the first point
  331.         baseMult 1 eq {
  332.             /connect.v connect.v pointSize 2 div 2 add sub def
  333.         } if
  334.         baseMult 2 eq {
  335.             /connect.v connect.v pointSize 2 div 2 add sub def
  336.         } if
  337.     } if
  338.     baseQualPos 3 eq
  339.     {    % to the right of the first point
  340.         baseMult 1 eq {
  341.             /connect.h connect.h pointSize 2 div 2 add sub def
  342.         } if
  343.         baseMult 2 eq {
  344.             /connect.h connect.h pointSize 2 div 2 add sub def
  345.         } if
  346.     } if
  347.     baseQualPos 4 eq
  348.     {    % below the first point
  349.         baseMult 1 eq {
  350.             /connect.v connect.v pointSize 2 div 2 add add def
  351.         } if
  352.         baseMult 2 eq {
  353.             /connect.v connect.v pointSize 2 div 2 add add def
  354.         } if
  355.     } if
  356.     baseQualPos 1 eq
  357.     {    % to the left of the first point
  358.         /p1.h connect.h baseQualTW 5 add sub def
  359.         /p1.v connect.v 3 sub def 
  360.     } if
  361.     baseQualPos 2 eq
  362.     {    % above the first point
  363.         /p1.h connect.h baseQualTW 2 div sub def
  364.         /p1.v connect.v 4 add def 
  365.     } if
  366.     baseQualPos 3 eq
  367.     {    % to the right of the first point
  368.         /p1.h connect.h 6 add def
  369.         /p1.v connect.v 3 sub def 
  370.     } if
  371.     baseQualPos 4 eq
  372.     {    % below the first point
  373.         /p1.h connect.h baseQualTW 2 div sub def
  374.         /p1.v connect.v 10 sub def
  375.     } if
  376.     /baseQualText.h p1.h def
  377.     /baseQualText.v p1.v def
  378.  
  379.     baseNavi 1 eq {
  380.         /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  381.         /p1.v pntArray noOfPoints 1 sub 2 mul get def
  382.         /p2.h pntArray noOfPoints 2 sub 2 mul 1 add get def
  383.         /p2.v pntArray noOfPoints 2 sub 2 mul get def
  384.         p2.h p2.v p1.h p1.v 1 5 5 false drawNavArrow
  385.     }if
  386.     branchNavi 1 eq {
  387.         /p1.h pntArray 1 get def
  388.         /p1.v pntArray 0 get def
  389.         /p2.h pntArray 3 get def
  390.         /p2.v pntArray 2 get def
  391.         p2.h p2.v p1.h p1.v 1 5 5 false drawNavArrow
  392.     }if
  393.  
  394.     /lineConnect.h connect.h def
  395.     /lineConnect.v connect.v def
  396.  
  397. % Determine the qualifiers rectangle size
  398.     baseQualTW 0 ne
  399.     {
  400.         baseQualPos 1 eq
  401.         {    % to the left of the first class
  402.             /RectRight connect.h def
  403.             /RectLeft baseQualText.h 5 sub def
  404.             /lineConnect.h RectLeft def
  405.             /RectTop baseQualText.v 12 add def
  406.             /RectBottom RectTop 16 sub def
  407.         } if
  408.         baseQualPos 3 eq
  409.         {    % to the right of the first class
  410.             /RectLeft connect.h def
  411.             /RectRight baseQualText.h baseQualTW 5 add add def
  412.             /lineConnect.h RectRight def
  413.             /RectTop baseQualText.v 12 add def
  414.             /RectBottom RectTop 16 sub def
  415.         } if
  416.         baseQualPos 2 eq
  417.         {    % above the first point
  418.             /RectBottom connect.v def
  419.             /RectTop RectBottom 16 add def
  420.             /lineConnect.v RectTop def
  421.             /RectLeft baseQualText.h 4 sub def
  422.             /RectRight RectLeft baseQualTW 9 add add def
  423.         } if
  424.         baseQualPos 4 eq
  425.         {    % below the first point
  426.             /RectTop connect.v def
  427.             /RectBottom RectTop 16 sub def
  428.             /lineConnect.v RectBottom def
  429.             /RectLeft baseQualText.h 4 sub def
  430.             /RectRight RectLeft baseQualTW add 9 add def
  431.         } if
  432.         RectLeft RectTop moveto
  433.         RectRight RectTop lineto
  434.         RectRight RectBottom lineto
  435.         RectLeft RectBottom lineto
  436.         closepath stroke
  437.         newpath
  438.         baseQualText.h baseQualText.v moveto
  439.         baseQual show
  440.     } if
  441.  
  442.     newpath 1 setlinewidth 0 setgray
  443.     /index 0 def
  444.     {
  445.         index noOfPoints eq { exit } if
  446.         pntArray index 2 mul 1 add get pntArray index 2 mul get
  447.         index noOfPoints 1 sub eq { pop pop lineConnect.h lineConnect.v } if
  448.         index 0 eq { moveto }{ lineto } ifelse
  449.         /index index 1 add def
  450.     } loop
  451.     stroke
  452.     /circle.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  453.     /circle.v pntArray noOfPoints 1 sub 2 mul get def
  454.     baseQualTW 0 ne
  455.     {
  456.         baseQualPos 1 eq
  457.         {    % to the left of the first class
  458.             /circle.h circle.h baseQualTW 9 add sub def
  459.         } if
  460.         baseQualPos 3 eq
  461.         {    % to the right of the first class
  462.             /circle.h circle.h baseQualTW 11 add add def
  463.         } if
  464.         baseQualPos 2 eq
  465.         {    % above the first point
  466.             /circle.v circle.v 16 add def
  467.         } if
  468.         baseQualPos 4 eq
  469.         {    % below the first point
  470.             /circle.v circle.v 16 sub def
  471.         } if
  472.     } if
  473.     circle.h circle.v
  474.     baseMult 1 eq {
  475.         % hollow circle
  476.         pointSize 0.5 sub 0 360 arc stroke
  477.         circle.h circle.v
  478.         pointSize 1 sub 0 360 arc 1 setgray fill
  479.     } if
  480.     baseMult 2 eq {
  481.         % filled circle
  482.         pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill
  483.     } if
  484.  
  485.     0 setgray /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  486.     /p1.v pntArray noOfPoints 1 sub 2 mul get def
  487.     /p2.h pntArray noOfPoints 2 sub 2 mul 1 add get def
  488.     /p2.v pntArray noOfPoints 2 sub 2 mul get def
  489.     /roletextwidth baseRole stringwidth pop def
  490.  
  491.     p1.h p2.h eq
  492.     { p1.v p2.v le
  493.         { p1.h 5 add p1.v 4 add baseQualTW 0 ne { 14 add } if }
  494.         { p1.h 5 add p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse
  495.     }
  496.     { p1.v p2.v eq
  497.         { p1.h p2.h gt
  498.                 { p1.h roletextwidth 5 add sub baseQualTW 0 ne { baseQualTW 9 add sub } if p1.v 10 sub }
  499.                 { p1.h 6 add baseQualTW 0 ne { baseQualTW 7 add add } if p1.v 10 sub } ifelse
  500.         }
  501.         {    p1.v p2.v le
  502.             {    p1.h p2.h gt
  503.                 { p1.h roletextwidth 5 add sub p1.v 4 add baseQualTW 0 ne { 14 add } if }
  504.                 { p1.h 6 add p1.v 4 add baseQualTW 0 ne { 14 add } if } ifelse
  505.             }
  506.             {    p1.h p2.h gt
  507.                 { p1.h roletextwidth 5 add sub p1.v 10 sub baseQualTW 0 ne { 14 sub } if }
  508.                 { p1.h 6 add p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse
  509.             } ifelse
  510.         } ifelse
  511.     } ifelse
  512.     moveto baseRole show
  513.     /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  514.     /p1.v pntArray noOfPoints 1 sub 2 mul get def
  515.     /p2.h pntArray noOfPoints 2 sub 2 mul 1 add get def
  516.     /p2.v pntArray noOfPoints 2 sub 2 mul get def
  517.     /multtextwidth baseMultText stringwidth pop def
  518.  
  519.     p1.h p2.h eq
  520.     { p1.v p2.v le
  521.             {    p1.h multtextwidth 5 add sub p1.v 4 add baseQualTW 0 ne { 14 add } if }
  522.             {    p1.h multtextwidth 5 add sub p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse
  523.     }
  524.     { p1.v p2.v eq
  525.             { p1.h p2.h gt
  526.                     { p1.h multtextwidth 5 add sub baseQualTW 0 ne { baseQualTW 9 add sub } if p1.v 4 add }
  527.                     { p1.h 5 add baseQualTW 0 ne { baseQualTW 7 add add } if p1.v 4 add } ifelse
  528.             }
  529.             { p1.v p2.v le
  530.                     { p1.h p2.h gt
  531.                             { p1.h multtextwidth 5 add sub p1.v 4 add baseQualTW 0 ne { 14 add } if }
  532.                             { p1.h 5 add p1.v 4 add baseQualTW 0 ne { 14 add } if } ifelse
  533.                     }
  534.                     { p1.h p2.h gt
  535.                             { p1.h multtextwidth 5 add sub p1.v 10 sub baseQualTW 0 ne { 14 sub } if }
  536.                             { p1.h 5 add p1.v 10 sub baseQualTW 0 ne { 14 sub } if } ifelse
  537.                     } ifelse
  538.             } ifelse
  539.     } ifelse
  540.     moveto
  541.     baseMult 3 eq {
  542.         baseMultText show
  543.     } if
  544.  
  545.     newpath
  546.     % Get the branch qualifier's position
  547.  
  548.     /branchQualTW branchQual stringwidth pop def
  549.     /p1.h pntArray 1 get def
  550.     /p1.v pntArray 0 get def
  551.     /connect.h p1.h def
  552.     /connect.v p1.v def
  553.     branchQualPos 1 eq
  554.     {    % to the left of the first point
  555.         branchMult 1 eq {
  556.             /connect.h connect.h pointSize 2 div 2 add add def
  557.         } if
  558.         branchMult 2 eq {
  559.             /connect.h connect.h pointSize 2 div 2 add add def
  560.         } if
  561.         /p1.h connect.h branchQualTW 5 add sub def
  562.         /p1.v connect.v 3 sub def 
  563.     } if
  564.     branchQualPos 2 eq
  565.     {    % above the first point
  566.         branchMult 1 eq {
  567.             /connect.v connect.v pointSize 2 div 2 add sub def
  568.         } if
  569.         branchMult 2 eq {
  570.             /connect.v connect.v pointSize 2 div 2 add sub def
  571.         } if
  572.         /p1.h connect.h branchQualTW 2 div sub def
  573.         /p1.v connect.v 4 add def 
  574.     } if
  575.     branchQualPos 3 eq
  576.     {    % to the right of the first point
  577.         branchMult 1 eq {
  578.             /connect.h connect.h pointSize 2 div 2 add sub def
  579.         } if
  580.         branchMult 2 eq {
  581.             /connect.h connect.h pointSize 2 div 2 add sub def
  582.         } if
  583.         /p1.h connect.h 6 add def
  584.         /p1.v connect.v 3 sub def 
  585.     } if
  586.     branchQualPos 4 eq
  587.     {    % below the first point
  588.         branchMult 1 eq {
  589.             /connect.v connect.v pointSize 2 div 2 add add def
  590.         } if
  591.         branchMult 2 eq {
  592.             /connect.v connect.v pointSize 2 div 2 add add def
  593.         } if
  594.         /p1.h connect.h branchQualTW 2 div sub def
  595.         /p1.v connect.v 10 sub def
  596.     } if
  597.     /branchQualText.h p1.h def
  598.     /branchQualText.v p1.v def
  599.  
  600.     /lineConnect.h connect.h def
  601.     /lineConnect.v connect.v def
  602.  
  603. % Determine the qualifiers rectangle size
  604.     branchQualTW 0 ne
  605.     {
  606.         branchQualPos 1 eq
  607.         {    % to the left of the first class
  608.             /RectRight connect.h def
  609.             /RectLeft branchQualText.h 5 sub def
  610.             /lineConnect.h RectLeft def
  611.             /RectTop branchQualText.v 12 add def
  612.             /RectBottom RectTop 16 sub def
  613.         } if
  614.         branchQualPos 3 eq
  615.         {    % to the right of the first class
  616.             /RectLeft connect.h def
  617.             /RectRight branchQualText.h branchQualTW 5 add add def
  618.             /lineConnect.h RectRight def
  619.             /RectTop branchQualText.v 12 add def
  620.             /RectBottom RectTop 16 sub def
  621.         } if
  622.         branchQualPos 2 eq
  623.         {    % above the first point
  624.             /RectBottom connect.v def
  625.             /RectTop RectBottom 16 add def
  626.             /lineConnect.v RectTop def
  627.             /RectLeft branchQualText.h 4 sub def
  628.             /RectRight RectLeft branchQualTW 9 add add def
  629.         } if
  630.         branchQualPos 4 eq
  631.         {    % below the first point
  632.             /RectTop connect.v def
  633.             /RectBottom RectTop 16 sub def
  634.             /lineConnect.v RectBottom def
  635.             /RectLeft branchQualText.h 4 sub def
  636.             /RectRight RectLeft branchQualTW add 9 add def
  637.         } if
  638.         RectLeft RectTop moveto
  639.         RectRight RectTop lineto
  640.         RectRight RectBottom lineto
  641.         RectLeft RectBottom lineto
  642.         closepath gsave 1 setgray fill grestore stroke
  643.         newpath
  644.         branchQualText.h branchQualText.v moveto
  645.         branchQual show
  646.     } if
  647.     newpath
  648.     0 setgray
  649.     /circle.h pntArray 1 get def
  650.     /circle.v pntArray 0 get def
  651.     branchQualTW 0 ne
  652.     {
  653.         branchQualPos 1 eq
  654.         {    % to the left of the first class
  655.             /circle.h circle.h branchQualTW 9 add sub def
  656.         } if
  657.         branchQualPos 3 eq
  658.         {    % to the right of the first class
  659.             /circle.h circle.h branchQualTW 11 add add def
  660.         } if
  661.         branchQualPos 2 eq
  662.         {    % above the first point
  663.             /circle.v circle.v 16 add def
  664.         } if
  665.         branchQualPos 4 eq
  666.         {    % below the first point
  667.             /circle.v circle.v 16 sub def
  668.         } if
  669.     } if
  670.     circle.h circle.v
  671.     branchMult 1 eq {
  672.         % hollow circle
  673.         pointSize 0.5 sub 0 360 arc stroke
  674.         circle.h circle.v
  675.         pointSize 1 sub 0 360 arc 1 setgray fill
  676.     } if
  677.     branchMult 2 eq {
  678.         % filled circle
  679.         pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill
  680.     } if
  681.  
  682.     0 setgray
  683.     /p1.h pntArray 1 get def
  684.     /p1.v pntArray 0 get def
  685.     /p2.h pntArray 3 get def
  686.     /p2.v pntArray 2 get def
  687.     /roletextwidth branchRole stringwidth pop def
  688.  
  689.     p1.h p2.h eq
  690.     {    p1.v p2.v le
  691.         { p1.h 5 add p1.v 4 add branchQualTW 0 ne { 14 add } if }
  692.         { p1.h 5 add p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse
  693.     }
  694.     { p1.v p2.v eq
  695.         {    p1.h p2.h gt
  696.             { p1.h roletextwidth 5 add sub branchQualTW 0 ne { branchQualTW 9 add sub } if p1.v 10 sub }
  697.             { p1.h 5 add branchQualTW 0 ne { branchQualTW 7 add add } if p1.v 10 sub } ifelse
  698.         }
  699.         {    p1.v p2.v le
  700.             {    p1.h p2.h gt
  701.                 {    p1.h roletextwidth 5 add sub p1.v 4 add branchQualTW 0 ne { 14 add } if }
  702.                 {    p1.h 5 add p1.v 4 add branchQualTW 0 ne { 14 add } if } ifelse
  703.             }
  704.             {    p1.h p2.h gt
  705.                 {    p1.h roletextwidth 5 add add p1.v 0 sub branchQualTW 0 ne { 14 sub } if }
  706.                 {    p1.h 5 add p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse
  707.             } ifelse
  708.         } ifelse
  709.     } ifelse
  710.     moveto branchRole show
  711.     /p1.h pntArray 1 get def
  712.     /p1.v pntArray 0 get def
  713.     /p2.h pntArray 3 get def
  714.     /p2.v pntArray 2 get def
  715.     /multtextwidth branchMultText stringwidth pop def
  716.  
  717.     p1.h p2.h eq
  718.     { p1.v p2.v le
  719.         {    p1.h multtextwidth 5 add sub p1.v 4 add branchQualTW 0 ne { 14 add } if }
  720.         {    p1.h multtextwidth 5 add sub p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse
  721.      }
  722.      { p1.v p2.v eq
  723.             { p1.h p2.h gt
  724.                     { p1.h multtextwidth 5 add sub branchQualTW 0 ne { branchQualTW 9 add sub } if p1.v     4 add }
  725.                     { p1.h 5 add branchQualTW 0 ne { branchQualTW 7 add add } if p1.v 4 add } ifelse
  726.             }
  727.             { p1.v p2.v le
  728.                     { p1.h p2.h gt
  729.                             { p1.h multtextwidth 5 add sub p1.v 4 add branchQualTW 0 ne { 14 add } if }
  730.                             { p1.h 5 add p1.v 4 add branchQualTW 0 ne { 14 add } if } ifelse
  731.                     }
  732.                     { p1.h p2.h gt
  733.                             { p1.h multtextwidth 5 add sub p1.v 10 sub branchQualTW 0 ne { 14 sub } if }
  734.                             { p1.h 5 add p1.v 10 sub branchQualTW 0 ne { 14 sub } if } ifelse
  735.                     } ifelse
  736.             } ifelse
  737.     } ifelse
  738.     moveto
  739.     branchMult 3 eq {
  740.         branchMultText show
  741.     }if
  742.     end
  743. } def
  744.  
  745. /drawAggr    % [ pointn ... point1 noOfPoints branchRole branchMultText branchMult navigable ] noOfBranches 
  746.             % pointn ... point1 noOfPoints baseRole baseMultText baseMult navigable qualPos qualifier name byvalue diamondx diamondy
  747. {
  748.     70 dict begin
  749.     Monaco9 setfont
  750.  
  751.     /diay exch def
  752.     /diax exch def
  753.     /byvalue exch def
  754.     /name exch def /qualifier exch def /qualPos exch def /baseNavigable exch def /baseMult exch def /baseMultText exch def 
  755.     /baseRole exch def
  756.     /noOfStemPoints exch def
  757.     /stemArray noOfStemPoints 2 mul array def
  758.     /index 0 def
  759.     {
  760.         index noOfStemPoints 2 mul eq { exit } if
  761.         stemArray index 3 -1 roll put
  762.         /index index 1 add def
  763.     } loop
  764.  
  765. % Get the qualifier's position
  766.     
  767.     /qualTW qualifier stringwidth pop def
  768.     /p1.h stemArray noOfStemPoints 1 sub 2 mul 1 add get def
  769.     /p1.v stemArray noOfStemPoints 1 sub 2 mul get def
  770.     /connect.h p1.h def
  771.     /connect.v p1.v def
  772.     qualPos 1 eq
  773.     {    % to the left of the first point
  774.         /connect.h connect.h diamondWidth 0.5 add add def
  775.         /p1.h connect.h qualTW 5 add sub def
  776.         /p1.v connect.v 3 sub def 
  777.     } if
  778.     qualPos 2 eq
  779.     {    % above the first point
  780.         /connect.v connect.v diamondWidth 1 add sub def
  781.         /p1.h connect.h qualTW 2 div sub def
  782.         /p1.v connect.v 4 add def 
  783.     } if
  784.     qualPos 3 eq
  785.     {    % to the right of the first point
  786.         /connect.h connect.h diamondWidth sub def
  787.         /p1.h connect.h 6 add def
  788.         /p1.v connect.v 3 sub def 
  789.     } if
  790.     qualPos 4 eq
  791.     {    % below the first point
  792.         /connect.v connect.v diamondWidth 0.5 add add def
  793.         /p1.h connect.h qualTW 2 div sub def
  794.         /p1.v connect.v 10 sub def
  795.     } if
  796.     /qualText.h p1.h def
  797.     /qualText.v p1.v def
  798.  
  799.     /lineConnect.h connect.h def
  800.     /lineConnect.v connect.v def
  801.  
  802. % Determine the qualifiers rectangle size
  803.     qualTW 0 ne
  804.     {
  805.         qualPos 1 eq
  806.         {    % to the left of the first class
  807.             /RectRight connect.h def
  808.             /RectLeft qualText.h 5 sub def
  809.             /lineConnect.h RectLeft def
  810.             /RectTop qualText.v 12 add def
  811.             /RectBottom RectTop 16 sub def
  812.         } if
  813.         qualPos 3 eq
  814.         {    % to the right of the first class
  815.             /RectLeft connect.h def
  816.             /RectRight qualText.h qualTW 5 add add def
  817.             /lineConnect.h RectRight def
  818.             /RectTop qualText.v 12 add def
  819.             /RectBottom RectTop 16 sub def
  820.         } if
  821.         qualPos 2 eq
  822.         {    % above the first point
  823.             /RectBottom connect.v def
  824.             /RectTop RectBottom 16 add def
  825.             /lineConnect.v RectTop def
  826.             /RectLeft qualText.h 4 sub def
  827.             /RectRight RectLeft qualTW 9 add add def
  828.         } if
  829.         qualPos 4 eq
  830.         {    % below the first point
  831.             /RectTop connect.v def
  832.             /RectBottom RectTop 16 sub def
  833.             /lineConnect.v RectBottom def
  834.             /RectLeft qualText.h 4 sub def
  835.             /RectRight RectLeft qualTW add 9 add def
  836.         } if
  837.         RectLeft RectTop moveto
  838.         RectRight RectTop lineto
  839.         RectRight RectBottom lineto
  840.         RectLeft RectBottom lineto
  841.         closepath stroke
  842.         newpath
  843.         qualText.h qualText.v moveto
  844.         qualifier show
  845.     } if
  846.  
  847.     /noOfBranches exch def /branchesArray noOfBranches array def /index 0 def
  848.     {
  849.         index noOfBranches eq { exit } if
  850.         /branchNavigable exch def
  851.         /branchMult exch def /branchMultText exch def
  852.         /branchRole exch def /noOfBranchPoints exch def
  853.  
  854.         noOfBranchPoints 0 ne {
  855.             /pntArray noOfBranchPoints 2 mul array def
  856.             /pntIndex 0 def
  857.             {
  858.                 pntIndex noOfBranchPoints 2 mul eq { exit } if
  859.                 pntArray pntIndex 3 -1 roll put
  860.                 /pntIndex pntIndex 1 add def
  861.             } loop
  862.  
  863.             /branchArray 6 array def
  864.              branchArray 0 branchMult put branchArray 1 branchMultText put
  865.             branchArray 2 branchRole put branchArray 3 noOfBranchPoints put
  866.             branchArray 4 branchNavigable put branchArray 5 pntArray put
  867.          }
  868.          {
  869.              /branchArray 5 array def
  870.             branchArray 0 branchMult put branchArray 1 branchMultText put
  871.             branchArray 2 branchRole put branchArray 3 noOfBranchPoints put
  872.             branchArray 4 branchNavigable put
  873.         } ifelse
  874.         branchesArray index branchArray put
  875.         /index index 1 add def
  876.     } loop
  877.     newpath 1 setlinewidth 0 setgray
  878.  
  879.     /p1.h stemArray noOfStemPoints 1 sub 2 mul 1 add get def
  880.     /p1.v stemArray noOfStemPoints 1 sub 2 mul get def
  881.     /p2.h stemArray noOfStemPoints 2 sub 2 mul 1 add get def
  882.     /p2.v stemArray noOfStemPoints 2 sub 2 mul get def
  883.     baseNavigable 1 eq
  884.     {
  885.         p2.h p2.v p1.h p1.v 1 5 5 false drawNavArrow
  886.     }if
  887.  
  888.     /index 0 def
  889.     {
  890.         index noOfStemPoints eq { exit } if
  891.         stemArray index 2 mul 1 add get stemArray index 2 mul get
  892. %        index noOfStemPoints 1 sub eq { pop pop lineConnect.h lineConnect.v } if
  893.         index 0 eq { moveto }{ lineto } ifelse
  894.         /index index 1 add def
  895.     } loop
  896.     branchesArray
  897.     {
  898.         /branch exch def /branchMult branch 0 get def
  899.         /branchNavigable branch 4 get def
  900.         /branchMultText branch 1 get def /noOfPoints branch 3 get def
  901.         noOfPoints 0 ne {
  902.             /pntArray branch 5 get def
  903.             /index 0 def
  904.             {
  905.                 index noOfPoints eq { exit } if
  906.                 pntArray index 2 mul 1 add get pntArray index 2 mul get
  907.                 index 0 eq {
  908.                     branchNavigable 1 eq {
  909.                         pntArray 3 get pntArray 2 get pntArray 1 get pntArray 0 get 1 5 5 false drawNavArrow
  910.                     }if
  911.                     moveto
  912.                 }{
  913.                     lineto
  914.                 } ifelse
  915.                 /index index 1 add def
  916.             } loop
  917.         } if
  918.     }forall
  919.     stroke
  920.     branchesArray
  921.     {
  922.         /branch exch def
  923.         /branchMult branch 0 get def /branchMultText branch 1 get def
  924.         /branchRole branch 2 get def /noOfPoints branch 3 get def
  925.         noOfPoints 0 ne {
  926.             /pntArray branch 5 get def
  927.             newpath
  928.             /p1.h pntArray 1 get def /p1.v pntArray 0 get def
  929.             /p2.h pntArray 3 get def /p2.v pntArray 2 get def
  930.         }
  931.         {
  932.             newpath
  933.             /p1.h stemArray 1 get def /p1.v stemArray 0 get def
  934.             /p2.h stemArray 3 get def /p2.v stemArray 2 get def
  935.         } ifelse
  936.  
  937.         0 setgray
  938.  
  939.         p1.h p1.v
  940.         branchMult 1 eq {
  941.             % hollow circle
  942.             pointSize 0.5 sub 0 360 arc stroke
  943.             p1.h p1.v
  944.             pointSize 1 sub 0 360 arc 1 setgray fill
  945.         } if
  946.         branchMult 2 eq {
  947.             % filled circle
  948.             pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill
  949.         } if
  950.  
  951.         0 setgray
  952.         /roletextwidth branchRole stringwidth pop def
  953.  
  954.         p1.h p2.h eq
  955.         {    p1.v p2.v le
  956.             {    p1.h 5 add    p1.v 4 add }{ p1.h 5 add p1.v 10 sub } ifelse
  957.         }
  958.         { p1.v p2.v eq
  959.             {    p1.h p2.h gt
  960.                 { p1.h roletextwidth 5 add sub p1.v 10 sub }{ p1.h 5 add p1.v 10 sub } ifelse
  961.             }
  962.             {    p1.v p2.v le
  963.                 {    p1.h p2.h gt
  964.                     {    p1.h roletextwidth 5 add sub p1.v 4 add }{    p1.h 5 add p1.v 4 add } ifelse
  965.                 }
  966.                 {    p1.h p2.h gt
  967.                     {    p1.h roletextwidth 5 add add p1.v 0 sub }
  968.                     {    p1.h 5 add p1.v 10 sub } ifelse
  969.                 } ifelse
  970.             } ifelse
  971.         } ifelse
  972.         moveto branchRole show
  973.  
  974.         noOfPoints 0 ne {
  975.             /pntArray branch 5 get def
  976.             newpath
  977.             /p1.h pntArray 1 get def /p1.v pntArray 0 get def
  978.             /p2.h pntArray 3 get def /p2.v pntArray 2 get def
  979.         }
  980.         {
  981.             newpath
  982.             /p1.h stemArray 1 get def /p1.v stemArray 0 get def
  983.             /p2.h stemArray 3 get def /p2.v stemArray 2 get def
  984.         } ifelse
  985.         /multtextwidth branchMultText stringwidth pop def
  986.         0 setgray
  987.  
  988.         p1.h p2.h eq
  989.         { p1.v p2.v le
  990.             {    p1.h multtextwidth 5 add sub p1.v 4 add }
  991.             {    p1.h multtextwidth 5 add sub p1.v 10 sub }     ifelse
  992.         }
  993.         { p1.v p2.v eq
  994.             { p1.h p2.h gt
  995.                 { p1.h multtextwidth 5 add sub p1.v 4 add }{ p1.h 5 add p1.v 4 add } ifelse
  996.             }
  997.             { p1.v p2.v le
  998.                 { p1.h p2.h gt
  999.                     { p1.h multtextwidth 5 add sub p1.v 4 add }{ p1.h 5 add p1.v 4 add } ifelse
  1000.                 }
  1001.                 { p1.h p2.h gt
  1002.                     { p1.h multtextwidth 5 add sub p1.v 10 sub }{ p1.h 5 add p1.v 10 sub } ifelse
  1003.                 } ifelse
  1004.             } ifelse
  1005.         } ifelse
  1006.         moveto
  1007.         branchMult 3 eq {
  1008.             branchMultText show
  1009.         }if
  1010.  
  1011.     }forall
  1012.     stroke
  1013.  
  1014.     0 setgray
  1015.     /p1.h stemArray noOfStemPoints 1 sub 2 mul 1 add get def
  1016.     /p1.v stemArray noOfStemPoints 1 sub 2 mul get def
  1017.     /p2.h stemArray noOfStemPoints 2 sub 2 mul 1 add get def
  1018.     /p2.v stemArray noOfStemPoints 2 sub 2 mul get def
  1019.     /roletextwidth baseRole stringwidth pop def
  1020.  
  1021.     p1.h p2.h eq
  1022.     { p1.v p2.v le
  1023.         { p1.h 5 add p1.v 1 sub qualTW 0 ne { 14 add } if }
  1024.         { p1.h 5 add p1.v 1 sub qualTW 0 ne { 14 sub } if } ifelse
  1025.     }
  1026.     { p1.v p2.v eq
  1027.         { p1.h p2.h gt
  1028.                 { p1.h roletextwidth 1 sub sub qualTW 0 ne { qualTW 9 add sub } if p1.v 10 sub }
  1029.                 { p1.h 1 sub qualTW 0 ne { qualTW 7 add add } if p1.v 10 sub } ifelse
  1030.         }
  1031.         {    p1.v p2.v le
  1032.             {    p1.h p2.h gt
  1033.                 { p1.h roletextwidth 5 add sub p1.v 4 add qualTW 0 ne { 14 add } if }
  1034.                 { p1.h 6 add p1.v 4 add qualTW 0 ne { 14 add } if } ifelse
  1035.             }
  1036.             {    p1.h p2.h gt
  1037.                 { p1.h roletextwidth 5 add sub p1.v 10 sub qualTW 0 ne { 14 sub } if }
  1038.                 { p1.h 6 add p1.v 10 sub qualTW 0 ne { 14 sub } if } ifelse
  1039.             } ifelse
  1040.         } ifelse
  1041.     } ifelse
  1042.     moveto baseRole show
  1043.  
  1044.     newpath
  1045.     p1.h p2.h eq
  1046.     { p1.v p2.v le
  1047.             { p1.h p1.v 3 add qualTW 0 ne { 15 add } if }
  1048.             { p1.h p1.v 3 sub qualTW 0 ne { 16 sub } if } ifelse
  1049.     }
  1050.     { p1.v p2.v eq
  1051.             { p1.h p2.h gt
  1052.                     { p1.h 2 sub qualTW 0 ne { qualTW 10 add sub } if p1.v }
  1053.                     { p1.h 2 add qualTW 0 ne { qualTW 12 add add } if p1.v } ifelse
  1054.             }
  1055.             { p1.v p2.v le
  1056.                     { p1.h p2.h gt
  1057.                             { p1.h pointSize 5 add sub p1.v 4 add qualTW 0 ne { 15 add } if }
  1058.                             { p1.h 5 add p1.v 4 add qualTW 0 ne { 15 add } if } ifelse
  1059.                     }
  1060.                     { p1.h p2.h gt
  1061.                             { p1.h pointSize 5 add sub p1.v 10 sub qualTW 0 ne { 15 sub } if }
  1062.                             { p1.h 5 add p1.v 10 sub qualTW 0 ne { 15 sub } if } ifelse
  1063.                     } ifelse
  1064.             } ifelse
  1065.     } ifelse
  1066.     /y exch def
  1067.     /x exch def
  1068.     x y
  1069.     baseMult 1 eq {
  1070.         % hollow circle
  1071.         pointSize 0.5 sub 0 360 arc stroke
  1072.         x y
  1073.         pointSize 1 sub 0 360 arc 1 setgray fill
  1074.     } if
  1075.     baseMult 2 eq {
  1076.         % filled circle
  1077.         pointSize 0.5 sub 0 360 arc gsave stroke grestore 0 setgray fill
  1078.     } if
  1079.  
  1080.     /multtextwidth baseMultText stringwidth pop def
  1081.  
  1082.     p1.h p2.h eq
  1083.     { p1.v p2.v le
  1084.             {    p1.h multtextwidth 5 add sub p1.v 1 sub qualTW 0 ne { 14 add } if }
  1085.             {    p1.h multtextwidth 5 add sub p1.v 1 sub qualTW 0 ne { 14 sub } if }     ifelse
  1086.     }
  1087.     { p1.v p2.v eq
  1088.             { p1.h p2.h gt
  1089.                     { p1.h multtextwidth 1 sub sub qualTW 0 ne { qualTW 9 add sub } if p1.v 4 add }
  1090.                     { p1.h 1 sub qualTW 0 ne { qualTW 7 add add } if p1.v 4 add } ifelse
  1091.             }
  1092.             { p1.v p2.v le
  1093.                     { p1.h p2.h gt
  1094.                             { p1.h multtextwidth 5 add sub p1.v 4 add qualTW 0 ne { 14 add } if }
  1095.                             { p1.h 5 add p1.v 4 add qualTW 0 ne { 14 add } if } ifelse
  1096.                     }
  1097.                     { p1.h p2.h gt
  1098.                             { p1.h multtextwidth 5 add sub p1.v 10 sub qualTW 0 ne { 14 sub } if }
  1099.                             { p1.h 5 add p1.v 10 sub qualTW 0 ne { 14 sub } if } ifelse
  1100.                     } ifelse
  1101.             } ifelse
  1102.     } ifelse
  1103.     moveto
  1104.     baseMult 3 eq {
  1105.         baseMultText show
  1106.     } if
  1107.  
  1108.     newpath 1 setlinewidth
  1109.     qualTW 0 ne
  1110.     {
  1111.         qualPos 1 eq
  1112.         {
  1113.             /diax diax qualTW 9 add sub def
  1114.         } if
  1115.         qualPos 2 eq
  1116.         {
  1117.             /diay diay 16 add def
  1118.         } if
  1119.         qualPos 3 eq
  1120.         {
  1121.             /diax diax qualTW 11 add add def
  1122.         } if
  1123.         qualPos 4 eq
  1124.         {
  1125.             /diay diay 16 sub def
  1126.         } if
  1127.     } if
  1128.  
  1129.     diax diamondWidth 2 div sub 0.5 add diay moveto
  1130.  
  1131.     diamondWidth 2 div 1 sub diamondWidth 2 div 1 sub rlineto
  1132.     diamondWidth 2 div 1 sub diamondWidth 2 div 1 sub neg rlineto
  1133.     diamondWidth 2 div 1 sub neg diamondWidth 2 div 1 sub neg rlineto
  1134.     closepath
  1135.     byvalue 0 eq { 1 setgray }{ 0 setgray } ifelse fill
  1136.  
  1137.     newpath 1 setlinewidth 0 setgray
  1138.     diax diamondWidth 2 div sub diay moveto
  1139.  
  1140.     diamondWidth 2 div 0.5 sub diamondWidth 2 div 0.5 sub rlineto
  1141.     diamondWidth 2 div 0.5 sub diamondWidth 2 div 0.5 sub neg rlineto
  1142.     diamondWidth 2 div 0.5 sub neg diamondWidth 2 div 0.5 sub neg rlineto
  1143.     closepath stroke
  1144.  
  1145.     end
  1146. } def
  1147.  
  1148.  
  1149. /genarrowdict 15 dict def
  1150. genarrowdict begin
  1151. /mtrx matrix def
  1152. end
  1153.  
  1154. /drawGenArrow %     tailx taily tipx tipy halfthickness halfheadthickness headlength dashed filled drawGenArrow
  1155. { genarrowdict begin
  1156.     /filled exch def
  1157.     /dashed exch def
  1158.     /headlength exch def
  1159.     /halfheadthickness exch 2 div def
  1160.     /halfthickness exch 2 div def
  1161.     /tipy exch def /tipx exch def
  1162.     /taily exch def /tailx exch def
  1163.  
  1164.     /dx tipx tailx sub def
  1165.     /dy tipy taily sub def
  1166.     /arrowlength dx dx mul dy dy mul add sqrt halfthickness sub def
  1167.     /angle dy dx atan def
  1168.     /base arrowlength headlength sub def
  1169.     /savematrix mtrx currentmatrix def
  1170.     tailx taily translate
  1171.     angle rotate
  1172.     base halfthickness neg moveto
  1173.     base halfheadthickness neg lineto
  1174.     arrowlength 0 lineto
  1175.     base halfheadthickness lineto
  1176.     base halfthickness lineto
  1177.     closepath
  1178.     filled true eq { fill }{ gsave 1 setgray fill grestore stroke } ifelse
  1179.     savematrix setmatrix
  1180.     newpath 1 setlinewidth
  1181.     tailx taily translate
  1182.     angle rotate
  1183.     dashed true eq { [3] 0 setdash }if
  1184.     0 0 moveto base 0 lineto stroke
  1185.     dashed true eq { [] 0 setdash }if
  1186.     savematrix setmatrix
  1187.     end
  1188. } def
  1189.  
  1190. % [ pointn ... point1 noOfPoints branchRole branchMultText branchMult navigable ] noOfBranches pointn ... point1 noOfPoints baseRole baseMultText baseMult qualPos qualifier name pyramidorientation pyramidx pyramidy omtNotation
  1191. /drawGen
  1192. {
  1193.     50 dict begin
  1194.     Monaco9 setfont
  1195.  
  1196.     /omtNotation exch def
  1197.     /pyry exch def
  1198.     /pyrx exch def
  1199.     /orient exch def
  1200.     /name exch def
  1201.       /noOfStemPoints exch def
  1202.     /stemArray noOfStemPoints 2 mul array def
  1203.     /index 0 def
  1204.     {
  1205.         index noOfStemPoints 2 mul eq { exit } if
  1206.         stemArray index 3 -1 roll put
  1207.         /index index 1 add def
  1208.     } loop
  1209.  
  1210.     /noOfBranches exch def
  1211.     /branchesArray noOfBranches array def
  1212.  
  1213.     /index 0 def
  1214.     {
  1215.         index noOfBranches eq { exit } if
  1216.  
  1217.         /navigable exch def
  1218.         /branchMult exch def /branchMultText exch def
  1219.         /branchRole exch def /noOfBranchPoints exch def
  1220.  
  1221.         noOfBranchPoints 0 ne {
  1222.             /pntArray noOfBranchPoints 2 mul array def
  1223.             /pntIndex 0 def
  1224.             {
  1225.                 pntIndex noOfBranchPoints 2 mul eq { exit } if
  1226.                 pntArray pntIndex 3 -1 roll put
  1227.                 /pntIndex pntIndex 1 add def
  1228.             } loop
  1229.  
  1230.             /branchArray 2 array def
  1231.           branchArray 0 noOfBranchPoints put branchArray 1 pntArray put
  1232.         }
  1233.         {
  1234.             /branchArray 1 array def
  1235.           branchArray 0 noOfBranchPoints put
  1236.         } ifelse
  1237.         branchesArray index branchArray put
  1238.         /index index 1 add def
  1239.     } loop
  1240.     newpath 1 setlinewidth 0 setgray
  1241.     /index 0 def
  1242.     {
  1243.         index noOfStemPoints eq { exit } if
  1244.         stemArray index 2 mul 1 add get stemArray index 2 mul get
  1245.         index 0 eq { moveto }{ lineto } ifelse
  1246.         /index index 1 add def
  1247.     } loop
  1248.  
  1249.     branchesArray
  1250.     {
  1251.         /branch exch def
  1252.         /noOfPoints branch 0 get def
  1253.         noOfPoints 0 ne {
  1254.             /pntArray branch 1 get def
  1255.             /index 0 def
  1256.             {
  1257.                 index noOfPoints eq { exit } if
  1258.                 pntArray index 2 mul 1 add get pntArray index 2 mul get
  1259.                 index 0 eq { moveto }{ lineto } ifelse
  1260.                 /index index 1 add def
  1261.             } loop
  1262.         }if
  1263.     }forall
  1264.     stroke
  1265.  
  1266.     newpath
  1267.     pyrx pyry moveto
  1268.  
  1269.     omtNotation 1 eq {
  1270.         orient 0 eq {
  1271.             pyramidWidth 2 div 1.6 sub 0 rlineto
  1272.             pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub rlineto
  1273.             pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub neg rlineto
  1274.         } if
  1275.         orient 2 eq {
  1276.             0 pyramidWidth 2 div 1.6 sub rlineto
  1277.             pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub neg rlineto
  1278.             pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub neg rlineto
  1279.         } if
  1280.         orient 4 eq {
  1281.             pyramidWidth 2 div 1.6 sub neg 0 rlineto
  1282.             pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub neg rlineto
  1283.             pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub rlineto
  1284.         } if
  1285.         orient 6 eq {
  1286.             0 pyramidWidth 2 div 1.6 sub neg rlineto
  1287.             pyramidWidth 2 div 1.6 sub pyramidWidth 2 div 1.6 sub rlineto
  1288.             pyramidWidth 2 div 1.6 sub neg pyramidWidth 2 div 1.6 sub rlineto
  1289.         } if
  1290.         closepath 1 setgray fill
  1291.  
  1292.         newpath 1 setlinewidth 0 setgray
  1293.         pyrx pyry moveto
  1294.  
  1295.         orient 0 eq {
  1296.             pyramidWidth 2 div 0.5 sub 0 rlineto
  1297.             pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub rlineto
  1298.             pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub neg rlineto
  1299.         } if
  1300.         orient 2 eq {
  1301.             0 pyramidWidth 2 div 0.5 sub rlineto
  1302.             pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub neg rlineto
  1303.             pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub neg rlineto
  1304.         } if
  1305.         orient 4 eq {
  1306.             pyramidWidth 2 div 0.5 sub neg 0 rlineto
  1307.             pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub neg rlineto
  1308.             pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub rlineto
  1309.         } if
  1310.         orient 6 eq {
  1311.             0 pyramidWidth 2 div 0.5 sub neg rlineto
  1312.             pyramidWidth 2 div 0.5 sub pyramidWidth 2 div 0.5 sub rlineto
  1313.             pyramidWidth 2 div 0.5 sub neg pyramidWidth 2 div 0.5 sub rlineto
  1314.         } if
  1315.         closepath stroke
  1316.     }
  1317.     {
  1318.         /i noOfStemPoints 2 mul def
  1319.         stemArray i 3 sub get stemArray i 4 sub get stemArray i 1 sub get stemArray i 2 sub get 1 15 20 false false drawGenArrow
  1320.     } ifelse
  1321.     
  1322.     end
  1323. } def
  1324.  
  1325. % pointn ... point1 noOfPoints name drawUCGen
  1326. /drawUCGen
  1327. {
  1328.     50 dict begin
  1329.  
  1330.     /name exch def
  1331.     /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def
  1332.     {
  1333.         index noOfPoints 2 mul eq { exit } if
  1334.         pntArray index 3 -1 roll put
  1335.         /index index 1 add def
  1336.     } loop
  1337.  
  1338.     Monaco9 setfont
  1339.     newpath 1 setlinewidth
  1340.     noOfPoints 2 gt {
  1341.         /index 0 def
  1342.         {
  1343.             index noOfPoints 1 sub eq { exit } if
  1344.             /p1.h pntArray index 2 mul 1 add get def
  1345.             /p1.v pntArray index 2 mul get def
  1346.             /p2.h pntArray index 1 add 2 mul 1 add get def
  1347.             /p2.v pntArray index 1 add 2 mul get def
  1348.             p1.h p1.v moveto p2.h p2.v lineto stroke
  1349.             /index index 1 add def
  1350.         } loop
  1351.     } if
  1352.  
  1353.     /p1.h pntArray 1 get def
  1354.     /p1.v pntArray 0 get def
  1355.     /p2.h pntArray 3 get def
  1356.     /p2.v pntArray 2 get def
  1357.     p2.h p2.v p1.h p1.v  1 15 20 false false drawGenArrow
  1358.  
  1359.     /p1.h pntArray noOfPoints 1 sub 2 mul 1 add get def
  1360.     /p1.v pntArray noOfPoints 1 sub 2 mul get def
  1361.     /p2.h pntArray noOfPoints 2 sub 2 mul 1 add get def
  1362.     /p2.v pntArray noOfPoints 2 sub 2 mul get def
  1363.  
  1364.     /width name stringwidth pop def
  1365.  
  1366.     p1.v p2.v eq {
  1367.         /p.v p1.v 7 add def
  1368.  
  1369.         p1.h p2.h lt {
  1370.             /p.h p2.h p1.h sub 2 div width 2 div sub p1.h add def
  1371.         }
  1372.         {
  1373.             /p.h p1.h p2.h sub 2 div width 2 div sub p2.h add def
  1374.         } ifelse
  1375.     }
  1376.     {
  1377.         p1.h p2.h eq {
  1378.             /p.h p1.h 5 add def
  1379.  
  1380.             p1.v p2.v lt {
  1381.                 /p.v p2.v p1.v sub 2 div p1.v add def
  1382.             }
  1383.             {
  1384.                 /p.v p1.v p2.v sub 2 div p2.v add def
  1385.             } ifelse
  1386.         }
  1387.         {
  1388.             p1.v p2.v lt {
  1389.                 /p.v p2.v p1.v sub 2 div p1.v add def
  1390.             }
  1391.             {
  1392.                 /p.v p1.v p2.v sub 2 div p2.v add def
  1393.             } ifelse
  1394.             
  1395.             p1.h p2.h lt {
  1396.                 /p.h p2.h p1.h sub 2 div width 2 div sub p1.h add def
  1397.             }
  1398.             {
  1399.                 /p.h p1.h p2.h sub 2 div width 2 div sub p2.h add def
  1400.             } ifelse
  1401.         }ifelse
  1402.     } ifelse
  1403.  
  1404.     p.h p.v moveto name show
  1405.  
  1406.     end
  1407. } def
  1408.  
  1409. /drawEventBox        % ulc.x ulc.y height
  1410. {
  1411.     50 dict begin
  1412.  
  1413.     /height exch def /ulcy exch def /ulcx exch def
  1414.  
  1415.     newpath 1 setlinewidth
  1416.     ulcx ulcy moveto eventBoxWidth 0 rlineto 0 height neg rlineto
  1417.     eventBoxWidth neg 0 rlineto closepath
  1418.     gsave stroke grestore
  1419.     1 setgray fill
  1420.     0 setgray fill
  1421.     end
  1422. } def
  1423.  
  1424. /drawEventThread    % ulc.x ulc.y height name
  1425. {
  1426.     50 dict begin
  1427.  
  1428.     /name exch def /height exch def /ulcy exch def /ulcx exch def
  1429.  
  1430.     newpath 1 setlinewidth
  1431.     Monaco10 setfont
  1432.     1 setlinewidth ulcx ulcy moveto 0 height neg rlineto stroke
  1433.     ulcx name stringwidth pop 2 div sub ulcy 10 add moveto name show
  1434.     end
  1435. } def
  1436.  
  1437. /drawEventEvent        % fulcx fulcy flrcx flrcy ulcx ulcy lrcx lrcy name dashed
  1438. {
  1439.     50 dict begin
  1440.  
  1441.     /dashed exch def /name exch def /lrcy exch def /lrcx exch def
  1442.     /ulcy exch def /ulcx exch def
  1443.     /flrcy exch def /flrcx exch def
  1444.     /fulcy exch def /fulcx exch def
  1445.  
  1446.     Monaco9 setfont
  1447.     newpath 1 setlinewidth
  1448.     ulcx ulcy lrcx lrcy 1 5 5 dashed true drawArrow
  1449.  
  1450.     fulcx flrcx gt
  1451.     {    % above to the left of p1
  1452.         /textx fulcx name stringwidth pop 3 add sub def
  1453.         /texty fulcy 2 add def
  1454.     }
  1455.     {    % above to the right of p1
  1456.         /textx fulcx 4 add def
  1457.         /texty fulcy 2 add def
  1458.     }ifelse
  1459.     textx texty moveto
  1460.     name show
  1461.     end
  1462. } def
  1463. /drawSupp        % pointn ... point1 noOfPoints name drawSupp
  1464. {
  1465.     50 dict begin
  1466.  
  1467.     /name exch def
  1468.     /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def
  1469.     {
  1470.         index noOfPoints 2 mul eq { exit } if
  1471.         pntArray index 3 -1 roll put
  1472.         /index index 1 add def
  1473.     } loop
  1474.  
  1475.     Monaco9 setfont
  1476.     [3] 0 setdash
  1477.     newpath 1 setlinewidth
  1478.     noOfPoints 2 gt {
  1479.         /index 0 def
  1480.         {
  1481.             index noOfPoints 1 sub eq { exit } if
  1482.             /p1.h pntArray index 2 mul 1 add get def
  1483.             /p1.v pntArray index 2 mul get def
  1484.             /p2.h pntArray index 1 add 2 mul 1 add get def
  1485.             /p2.v pntArray index 1 add 2 mul get def
  1486.             p1.h p1.v moveto p2.h p2.v lineto stroke
  1487.             /index index 1 add def
  1488.         } loop
  1489.     } if
  1490.  
  1491.     /p1.h pntArray 1 get def
  1492.     /p1.v pntArray 0 get def
  1493.     /p2.h pntArray 3 get def
  1494.     /p2.v pntArray 2 get def
  1495.     [] 0 setdash
  1496.     p2.h p2.v p1.h p1.v 1 5 5 true drawNavArrow
  1497.  
  1498.     end
  1499. } def
  1500.  
  1501. /fourpops { pop pop pop pop } def
  1502. /drawRoundedBox % ulcx ulcy width height
  1503. {
  1504.     50 dict begin
  1505.  
  1506.     /height exch def /width exch def
  1507.     /ulcy exch def /ulcx exch def
  1508.  
  1509.     /lrcx ulcx width add def /lrcy ulcy height sub def
  1510.  
  1511.     ulcx lrcy 10 add moveto
  1512.     ulcx lrcy lrcx lrcy 5 arcto fourpops
  1513.     lrcx lrcy lrcx ulcy 5 arcto fourpops
  1514.     lrcx ulcy ulcx ulcy 5 arcto fourpops
  1515.     ulcx ulcy ulcx lrcy 5 arcto fourpops
  1516.     closepath
  1517.     gsave 1 setgray fill grestore stroke
  1518.     end
  1519. } def
  1520.  
  1521. /drawStateBox % actionn eventn .. action1 event1 noOfEvents exitlinen exitline1 noOfExitLines dolinen doline1 noOfDoLines entrylinen entryline1 noOfEntryLines name
  1522. {
  1523.     50 dict begin
  1524.  
  1525.     /boxheight 30 def
  1526.     /boxwidth 60 def
  1527.     /name exch def 
  1528.  
  1529. %
  1530. % Get all the entry/ lines and store them in entryLineArray
  1531. %
  1532.     /noOfEntryLines exch def
  1533.     /entryLineWidth 0 def     /entryHeight 0 def
  1534.     noOfEntryLines 0 ne
  1535.     { 
  1536.         /entryLineArray noOfEntryLines array def
  1537.         /entryLineIndex 0 def
  1538.         {
  1539.             entryLineIndex noOfEntryLines eq { exit } if
  1540.             entryLineArray entryLineIndex 3 -1 roll put
  1541.             /entryLineIndex entryLineIndex 1 add def
  1542.         } loop
  1543.         /entryHeight entryLineIndex 12 mul def
  1544.         /rubrikwidth MonacoI9 setfont (entry/ ) stringwidth pop def
  1545.         Monaco9 setfont
  1546.         entryLineArray
  1547.         {
  1548.             stringwidth pop dup rubrikwidth add 16 add
  1549.             entryLineWidth gt { /entryLineWidth exch def }{ pop } ifelse
  1550.         } forall
  1551.     } if
  1552.  
  1553. %
  1554. % Get all the do: lines and store them in doLineArray
  1555. %
  1556.     /noOfDoLines exch def
  1557.     /doLineWidth 0 def     /doHeight 0 def
  1558.     noOfDoLines 0 ne
  1559.     { 
  1560.         /doLineArray noOfDoLines array def
  1561.         /doLineIndex 0 def
  1562.         {
  1563.             doLineIndex noOfDoLines eq { exit } if
  1564.             doLineArray doLineIndex 3 -1 roll put
  1565.             /doLineIndex doLineIndex 1 add def
  1566.         } loop
  1567.         /doHeight doLineIndex 12 mul def
  1568.         /rubrikwidth Monaco9 setfont (do: ) stringwidth pop def
  1569.         doLineArray
  1570.         {
  1571.             stringwidth pop dup rubrikwidth add 16 add
  1572.             doLineWidth gt { /doLineWidth exch def }{ pop } ifelse
  1573.         } forall
  1574.     } if
  1575.  
  1576. %
  1577. % Get all the exit/ lines and store them in exitLineArray
  1578. %
  1579.     /noOfExitLines exch def
  1580.     /exitLineWidth 0 def     /exitHeight 0 def
  1581.     noOfExitLines 0 ne
  1582.     { 
  1583.         /exitLineArray noOfExitLines array def
  1584.         /exitLineIndex 0 def
  1585.         {
  1586.             exitLineIndex noOfExitLines eq { exit } if
  1587.             exitLineArray exitLineIndex 3 -1 roll put
  1588.             /exitLineIndex exitLineIndex 1 add def
  1589.         } loop
  1590.         /exitHeight exitLineIndex 12 mul def
  1591.         /rubrikwidth MonacoI9 setfont (exit/ ) stringwidth pop def
  1592.         Monaco9 setfont
  1593.         exitLineArray
  1594.         {
  1595.             stringwidth pop dup rubrikwidth add 16 add
  1596.             exitLineWidth gt { /exitLineWidth exch def }{ pop } ifelse
  1597.         } forall
  1598.     } if
  1599.  
  1600. %
  1601. % Get all the event/ lines and store each event in the eventsArray
  1602. % Each element of the eventsArray is another array where the first
  1603. % item holds the number of lines (following items)
  1604. %
  1605.     /noOfEvents exch def
  1606.     /eventHeight 0 def
  1607.     noOfEvents 0 ne
  1608.     { 
  1609.         /eventsArray noOfEvents array def
  1610.         /eventIndex 0 def
  1611.         {
  1612.             eventIndex noOfEvents eq { exit } if
  1613.             /noOfEventLines exch def
  1614.             /eventArray noOfEventLines 2 add array def
  1615.             eventArray 0 noOfEventLines put
  1616.             /lineIndex 1 def
  1617.             {
  1618.                 lineIndex noOfEventLines 2 add eq { exit } if
  1619.                 eventArray lineIndex 3 -1 roll put
  1620.                 /lineIndex lineIndex 1 add def
  1621.             } loop
  1622.             eventsArray eventIndex eventArray put
  1623.             /eventIndex eventIndex 1 add def
  1624.         } loop
  1625.  
  1626.         /eventLineWidth 0 def
  1627.  
  1628.         eventsArray
  1629.         {
  1630.             /ar exch def
  1631.             /noOfLines ar 0 get def
  1632.             /eventHeight eventHeight noOfLines add def
  1633.             /rubrikwidth ar noOfLines 1 add get MonacoI9 setfont stringwidth pop def
  1634.          Monaco9 setfont
  1635.             /item noOfLines def
  1636.             {
  1637.                 item 0 eq { exit } if
  1638.                 ar item get Monaco9 setfont stringwidth pop
  1639.                 rubrikwidth add 16 add dup
  1640.                 boxwidth gt { /boxwidth exch def }{ pop } ifelse
  1641.                 /item item 1 sub def
  1642.             } loop
  1643.         } forall
  1644.     /eventHeight eventHeight 10 mul def
  1645.     } if
  1646.  
  1647.     currentpoint /ulcy exch def /ulcx exch def
  1648.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  1649.  
  1650.     Monaco10 setfont
  1651.     name stringwidth pop dup 8 add
  1652.     boxwidth gt { /boxwidth exch def }{ pop } ifelse
  1653.  
  1654.     entryLineWidth boxwidth gt { /boxwidth entryLineWidth def } if
  1655.     doLineWidth boxwidth gt { /boxwidth doLineWidth def } if
  1656.     exitLineWidth boxwidth gt { /boxwidth exitLineWidth def } if
  1657.  
  1658.     30 exitHeight add doHeight add entryHeight add eventHeight add dup
  1659.     boxheight gt { /boxheight exch def }{ pop } ifelse
  1660.  
  1661. % Draw the name of the state
  1662.     Monaco10 setfont
  1663.     ulcx ulcy boxwidth boxheight drawRoundedBox
  1664.     ulcx boxwidth name stringwidth pop sub 2 div add
  1665.     ulcy 18 sub moveto name show
  1666.  
  1667.     /entryIndex 0 def
  1668.     entryHeight 0 ne
  1669.     {
  1670.         /item noOfEntryLines 1 sub def
  1671.         {
  1672.             item -1 eq { exit }if
  1673.             entryLineArray item get
  1674.             /item item 1 sub def
  1675.             ulcx 5 add ulcy 30 sub entryIndex 10 mul sub moveto
  1676.             entryIndex 0 eq { MonacoI9 setfont (entry/ ) show
  1677.                                                                 /leftmargin currentpoint pop ulcx 5 add sub def Monaco9 setfont }
  1678.                                                                 { leftmargin 0 rmoveto } ifelse
  1679.             show
  1680.             /entryIndex entryIndex 1 add def
  1681.         } loop
  1682.     } if
  1683.     Monaco9 setfont
  1684.     /doIndex 0 def
  1685.     doHeight 0 ne
  1686.     {
  1687.         /item noOfDoLines 1 sub def
  1688.         {
  1689.             item -1 eq { exit }if
  1690.             doLineArray item get
  1691.             /item item 1 sub def
  1692.             ulcx 5 add ulcy 30 sub doIndex 10 mul sub entryIndex 10 mul sub moveto
  1693.             doIndex 0 eq { (do: ) show /leftmargin currentpoint pop ulcx 5 add sub def }{ leftmargin 0 rmoveto } ifelse
  1694.             show
  1695.             /doIndex doIndex 1 add def
  1696.         } loop
  1697.     } if
  1698.  
  1699.     /eventIndex 0 def
  1700.     eventHeight 0 ne
  1701.     {
  1702.         /item noOfEvents 1 sub def
  1703.         {
  1704.             item -1 eq { exit }if
  1705.             /ar eventsArray item get def
  1706.             /item item 1 sub def
  1707.             /noOfLines ar 0 get def
  1708.             /lineIndex noOfLines 1 add def
  1709.             {
  1710.                 lineIndex 0 eq { exit } if
  1711.                 ar lineIndex get
  1712.                 ulcx 5 add ulcy 32 sub entryIndex 10 mul sub doIndex 10 mul sub eventIndex 10 mul sub moveto
  1713.                 lineIndex noOfLines 1 add eq
  1714.                 {
  1715.                     MonacoI9 setfont show ( ) show  /leftmargin currentpoint pop ulcx 5 add sub def
  1716.                     ar noOfLines get Monaco9 setfont show
  1717.                     /lineIndex lineIndex 2 sub def
  1718.                 }
  1719.                 {
  1720.                     leftmargin 0 rmoveto show
  1721.                     /lineIndex lineIndex 1 sub def
  1722.                 }ifelse
  1723.                 /eventIndex eventIndex 1 add def
  1724.             } loop
  1725.         } loop
  1726.     } if
  1727.  
  1728.     /exitIndex 0 def
  1729.     exitHeight 0 ne
  1730.     {
  1731.         /item noOfExitLines 1 sub def
  1732.         {
  1733.             item -1 eq { exit }if
  1734.             exitLineArray item get
  1735.             /item item 1 sub def
  1736.             ulcx 5 add ulcy 32 sub entryIndex 10 mul sub doIndex 10 mul sub eventIndex 10 mul sub exitIndex 10 mul sub moveto
  1737.             exitIndex 0 eq { MonacoI9 setfont (exit/ ) show
  1738.             /leftmargin currentpoint pop ulcx 5 add sub def
  1739.             Monaco9 setfont } { leftmargin 0 rmoveto }ifelse
  1740.             show
  1741.             /exitIndex exitIndex 1 add def
  1742.         } loop
  1743.     } if
  1744.     leftmargin boxwidth add topmargin boxheight sub
  1745.     end
  1746. } def
  1747.  
  1748. /drawStateEvent % [ pointn ... point1 ] noOfPoints eventtext
  1749.     50 dict begin
  1750.     Monaco9 setfont
  1751.  
  1752.     /eventtext exch def
  1753.  
  1754.     /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def
  1755.     {
  1756.         index noOfPoints 2 mul eq { exit } if
  1757.         pntArray index 3 -1 roll put
  1758.         /index index 1 add def
  1759.     } loop
  1760.  
  1761.     newpath 1 setlinewidth 0 setgray
  1762.     /index 0 def
  1763.     {
  1764.         index noOfPoints eq { exit } if
  1765.         pntArray index 2 mul 1 add get pntArray index 2 mul get
  1766.         index 0 eq { moveto }{ lineto } ifelse
  1767.         /index index 1 add def
  1768.     } loop
  1769.     stroke
  1770.     pntArray noOfPoints 1 sub 2 mul 1 add get pntArray noOfPoints 1 sub 2 mul get
  1771.     pntArray noOfPoints 2 sub 2 mul 1 add get pntArray noOfPoints 2 sub 2 mul get
  1772.  
  1773. %
  1774. % Last line's x and y are on top of the stack
  1775. %
  1776.     /p1.v exch def
  1777.     /p1.h exch def
  1778.     /p2.v exch def
  1779.     /p2.h exch def
  1780.     /width eventtext stringwidth pop def
  1781.  
  1782.     p1.v p2.v eq
  1783.     {
  1784.         /p.v p1.v 7 add def
  1785.         p1.h p2.h lt
  1786.         {
  1787.             /p.h p1.h p2.h p1.h sub 2 div add  width 2 div   sub def
  1788.         }
  1789.         {
  1790.             /p.h p2.h p1.h p2.h sub 2 div add   width 2 div   sub def
  1791.         }ifelse
  1792.     }
  1793.     {
  1794.         p1.h p2.h eq
  1795.         {
  1796.             /p.h p1.h 5 add def
  1797.             p1.v p2.v ge
  1798.             {
  1799.                 /p.v p1.v p2.v p1.v sub 2 div add def
  1800.             }
  1801.             {
  1802.                 /p.v p2.v p1.v p2.v sub 2 div add def
  1803.             }ifelse
  1804.         }
  1805.         {
  1806.             p1.v p2.v ge
  1807.             {
  1808.                 /p.v  p1.v p2.v p1.v sub 2 div add def
  1809.             }
  1810.             {
  1811.                 /p.v  p2.v p1.v p2.v sub 2 div add def
  1812.             }ifelse
  1813.  
  1814.             p1.h p2.h lt
  1815.             {
  1816.                 /p.h  p1.h p2.h p1.h sub 2 div width 2 div sub add def
  1817.             }
  1818.             {
  1819.                 /p.h  p2.h p1.h p2.h sub 2 div width 2 div sub add def
  1820.             }ifelse
  1821.         }ifelse
  1822.     }ifelse
  1823.  
  1824.     MonacoI9 setfont
  1825.     p.h p.v moveto eventtext show
  1826.  
  1827.     pntArray 1 get pntArray 0 get
  1828.     /p1.v exch def /p1.h exch def
  1829.     pntArray 3 get pntArray 2 get
  1830.     /p2.v exch def /p2.h exch def
  1831.  
  1832.     p1.h p2.h eq
  1833.     {
  1834.         p1.v p2.v gt
  1835.         {
  1836.             /p1.v p1.v 5 sub def
  1837.         }
  1838.         {
  1839.             /p1.v p1.v 5 add def
  1840.         }ifelse
  1841.     }
  1842.     {
  1843.         p1.h p2.h gt
  1844.         {
  1845.             /p1.h p1.h 5 sub def
  1846.         }
  1847.         {
  1848.             /p1.h p1.h 5 add def
  1849.         }ifelse
  1850.     } ifelse
  1851.  p2.h p2.v p1.h p1.v 1 5 5 false true drawArrow
  1852.  
  1853.     end
  1854. } def
  1855.  
  1856. /drawNote %  linen line1 noOfLines width height drawNote
  1857. {
  1858.     50 dict begin
  1859.  
  1860.     /boxheight exch def
  1861.     /boxwidth exch def
  1862.  
  1863. %
  1864. % Get all the lines and store them in lineArray
  1865. %
  1866.     Monaco9 setfont
  1867.  
  1868.     /noOfLines exch def
  1869.     noOfLines 0 ne
  1870.     { 
  1871.         /lineArray noOfLines array def
  1872.         /lineIndex 0 def
  1873.         {
  1874.             lineIndex noOfLines eq { exit } if
  1875.             lineArray lineIndex 3 -1 roll put
  1876.             /lineIndex lineIndex 1 add def
  1877.         } loop
  1878.     } if
  1879.  
  1880.     currentpoint /ulcy exch def /ulcx exch def
  1881.  
  1882.     % compute max width of text lines
  1883.     /maxwidth 0 def
  1884.     noOfLines 0 ne
  1885.     {
  1886.         /item noOfLines 1 sub def
  1887.         {
  1888.             item -1 eq { exit }if
  1889.             lineArray item get
  1890.             stringwidth pop
  1891.             /width exch def
  1892.             maxwidth width lt { /maxwidth width def }if
  1893.             /item item 1 sub def
  1894.         } loop
  1895.     } if
  1896.     boxwidth maxwidth lt { /boxwidth maxwidth def }if
  1897.  
  1898.     % draw the box
  1899.     currentpoint boxwidth 0 rlineto
  1900.     0 boxheight neg rlineto
  1901.     boxwidth neg 0 rlineto closepath stroke
  1902.  
  1903.     % set clipping region
  1904.     gsave
  1905.     newpath
  1906.     ulcx 5 add ulcy moveto
  1907.     boxwidth 10 sub 0 rlineto
  1908.     0 boxheight neg rlineto
  1909.     boxwidth 10 sub neg 0 rlineto closepath clip
  1910.  
  1911.     /index 0 def
  1912.     noOfLines 0 ne
  1913.     {
  1914.         /item noOfLines 1 sub def
  1915.         {
  1916.             item -1 eq { exit }if
  1917.             lineArray item get
  1918.             /item item 1 sub def
  1919.             ulcx 5 add ulcy 12 sub index 10 mul sub moveto
  1920.             show
  1921.             /index index 1 add def
  1922.         } loop
  1923.     } if
  1924.     grestore
  1925.     newpath
  1926.     ulcx boxwidth add 14 sub ulcy moveto
  1927.     14 0 rlineto
  1928.     0 -10 rlineto closepath gsave stroke grestore 0.5 setgray fill
  1929.  
  1930.     2 setlinejoin
  1931.     ulcx boxwidth add 14 sub ulcy moveto
  1932.  
  1933.     ulcx boxwidth add 12 sub ulcy 3 sub        % x1, y1
  1934.     ulcx boxwidth add 11 sub ulcy 5 sub        % x2, y2
  1935.     ulcx boxwidth add 12 sub ulcy 10 sub    % x3, y3
  1936.     curveto
  1937.  
  1938.     ulcx boxwidth add 9 sub ulcy 8 sub    % x1, y1
  1939.     ulcx boxwidth add 4 sub ulcy 8 sub    % x2, y2
  1940.     ulcx boxwidth add ulcy 10 sub        % x3, y3
  1941.     curveto
  1942.  
  1943.     closepath gsave 1 setgray fill grestore 0 setgray stroke
  1944.     0 setlinejoin
  1945.  
  1946.     ulcx boxwidth add ulcy boxheight sub
  1947.  
  1948.     end
  1949. } def
  1950.  
  1951.  
  1952. /drawInitialState %  diameter x y drawInitialState
  1953. {
  1954.     50 dict begin
  1955.  
  1956.     /y exch def
  1957.     /x exch def
  1958.     /circleSize exch def
  1959.     newpath
  1960.     x circleSize 2 div add
  1961.     y circleSize 2 div sub
  1962.     circleSize 2 div
  1963.     0 360 arc
  1964.     closepath gsave stroke grestore fill
  1965.  
  1966.     end
  1967. } def
  1968.  
  1969. /drawFinalState %  diameter x y drawFinalState
  1970. {
  1971.     50 dict begin
  1972.  
  1973.     /y exch def
  1974.     /x exch def
  1975.     /circleSize exch def
  1976.     newpath
  1977.     x circleSize 2 div add
  1978.     y circleSize 2 div sub
  1979.     circleSize 2 div
  1980.     0 360 arc
  1981.     closepath stroke
  1982.     newpath
  1983.     x circleSize 2 div add
  1984.     y circleSize 2 div sub
  1985.     circleSize 2 div 3 sub
  1986.     0 360 arc
  1987.     closepath fill
  1988.  
  1989.     end
  1990. } def
  1991.  
  1992. /drawActor %  name
  1993. {
  1994.     50 dict begin
  1995.  
  1996.     /actorheight 75 def
  1997.     /actorwidth 30 def
  1998.     /name exch def 
  1999.  
  2000.     currentpoint /ulcy exch def /ulcx exch def
  2001.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  2002.  
  2003.     Monaco10 setfont
  2004.     /namewidth name stringwidth pop def
  2005.  
  2006.     /nameleft ulcx actorwidth 2 div add namewidth 2 div sub def
  2007.  
  2008. % Draw the name of the actor
  2009.     nameleft ulcy actorheight sub 5 add moveto name show
  2010.  
  2011. % Draw the stickman
  2012.     
  2013. % First head
  2014.     newpath
  2015.     ulcx actorwidth 2 div add    % x
  2016.     ulcy 10 sub                    % y
  2017.     10                            % r
  2018.     0 360 arc stroke
  2019.  
  2020. % then body
  2021.     newpath
  2022.     ulcx actorwidth 2 div add ulcy 20 sub moveto
  2023.     ulcx actorwidth 2 div add ulcy 20 sub actorheight 45 sub sub lineto
  2024.  
  2025. % then the legs
  2026.     actorwidth 2 div 1 sub neg -10 rlineto
  2027.     actorwidth 2 div 10 rmoveto
  2028.     actorwidth 2 div -10 rlineto
  2029.  
  2030. % then the arms
  2031.     ulcx ulcy 35 sub moveto
  2032.     actorwidth 2 div 5 rlineto
  2033.     actorwidth 2 div 1 sub -5 rlineto
  2034.     stroke
  2035.  
  2036.     leftmargin actorwidth add topmargin actorheight sub
  2037.     end
  2038. } def
  2039.  
  2040. /drawPackage %  name
  2041. {
  2042.     50 dict begin
  2043.  
  2044.     /packageheight 50 def
  2045.     /packagewidth 80 def
  2046.     /name exch def 
  2047.  
  2048.     currentpoint /ulcy exch def /ulcx exch def
  2049.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  2050.  
  2051.     Monaco10 setfont
  2052.     /namewidth name stringwidth pop def
  2053.  
  2054.     namewidth 6 add packagewidth gt { /packagewidth namewidth 6 add def } if
  2055.  
  2056.     /nameleft ulcx packagewidth 2 div add namewidth 2 div sub def
  2057.  
  2058.     ulcx ulcy 10 sub moveto
  2059.     ulcx packagewidth add ulcy 10 sub lineto
  2060.     ulcx packagewidth add ulcy packageheight sub 1 add lineto
  2061.     ulcx ulcy packageheight sub 1 add lineto
  2062.     closepath stroke
  2063.     newpath
  2064.     ulcx ulcy moveto
  2065.     ulcx 30 add ulcy lineto
  2066.     ulcx 30 add ulcy 10 sub lineto
  2067.     ulcx ulcy 10 sub lineto
  2068.     closepath stroke
  2069.  
  2070.     newpath
  2071.     nameleft ulcy 25 sub moveto
  2072.     name show
  2073.  
  2074.     leftmargin packagewidth add topmargin packageheight sub
  2075.     end
  2076. } def
  2077. /drawFrame %  width height
  2078. {
  2079.     50 dict begin
  2080.  
  2081.     /frameheight exch def
  2082.     /framewidth exch def
  2083.  
  2084.     currentpoint /ulcy exch def /ulcx exch def
  2085.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  2086.  
  2087.     ulcx framewidth add ulcy lineto
  2088.     ulcx framewidth add ulcy frameheight sub 1 add lineto
  2089.     ulcx ulcy frameheight sub 1 add lineto
  2090.     closepath stroke
  2091.  
  2092.     leftmargin framewidth add topmargin frameheight sub
  2093.     end
  2094. } def
  2095.  
  2096. /drawUseCase %  name
  2097. {
  2098.     50 dict begin
  2099.  
  2100.     /usecaseheight 50 def
  2101.     /usecasewidth 90 def
  2102.     /name exch def 
  2103.  
  2104.     currentpoint /ulcy exch def /ulcx exch def
  2105.     /leftmargin currentpoint pop def /topmargin currentpoint exch pop def
  2106.  
  2107.     Monaco10 setfont
  2108.     /namewidth name stringwidth pop def
  2109.  
  2110.     namewidth 6 add usecasewidth gt { /usecasewidth namewidth 6 add def } if
  2111.  
  2112.     /nameleft ulcx usecasewidth 2 div add namewidth 2 div sub def
  2113.  
  2114.     newpath
  2115.     ulcx usecasewidth 2 div add ulcy usecaseheight 2 div sub translate
  2116.     usecasewidth usecaseheight div 1 scale
  2117.     0 0 usecaseheight 2 div 0 360 arc
  2118.     usecaseheight usecasewidth div 1 scale
  2119.     ulcx usecasewidth 2 div add neg ulcy usecaseheight 2 div sub neg translate
  2120.     stroke
  2121.  
  2122.     newpath
  2123.     nameleft ulcy 25 sub moveto
  2124.     name show
  2125.  
  2126.     leftmargin usecasewidth add topmargin usecaseheight sub
  2127.     end
  2128. } def
  2129.  
  2130. /drawText %  linen line1 noOfLines typeface size drawText
  2131. {
  2132.     50 dict begin
  2133.  
  2134.     /size exch def
  2135.     /typeface exch def
  2136.  
  2137. %
  2138. % Get all the lines and store them in lineArray
  2139. %
  2140. %    stdencoding typeface RE findfont size scalefont def
  2141.     typeface findfont size scalefont setfont
  2142.  
  2143.     /noOfLines exch def
  2144.     noOfLines 0 ne
  2145.     { 
  2146.         /lineArray noOfLines array def
  2147.         /lineIndex 0 def
  2148.         {
  2149.             lineIndex noOfLines eq { exit } if
  2150.             lineArray lineIndex 3 -1 roll put
  2151.             /lineIndex lineIndex 1 add def
  2152.         } loop
  2153.     } if
  2154.  
  2155.     currentpoint /ulcy exch def /ulcx exch def
  2156.  
  2157.     % compute max width of text lines
  2158.     /maxwidth 0 def
  2159.     noOfLines 0 ne
  2160.     {
  2161.         /item noOfLines 1 sub def
  2162.         {
  2163.             item -1 eq { exit }if
  2164.             lineArray item get
  2165.             stringwidth pop
  2166.             /width exch def
  2167.             maxwidth width lt { /maxwidth width def }if
  2168.             /item item 1 sub def
  2169.         } loop
  2170.     } if
  2171.  
  2172.     /index 0 def
  2173.     noOfLines 0 ne
  2174.     {
  2175.         /item noOfLines 1 sub def
  2176.         {
  2177.             item -1 eq { exit }if
  2178.             lineArray item get
  2179.             /item item 1 sub def
  2180.             ulcx 5 add ulcy 12 sub index 10 mul sub moveto
  2181.             show
  2182.             /index index 1 add def
  2183.         } loop
  2184.     } if
  2185.  
  2186.     end
  2187. } def
  2188.  
  2189. /drawCommunicates    % pointn ... point1 noOfPoints name
  2190. {
  2191.     50 dict begin
  2192.     Monaco9 setfont
  2193.  
  2194.     /name exch def
  2195.     /noOfPoints exch def /pntArray noOfPoints 2 mul array def /index 0 def
  2196.     {
  2197.         index noOfPoints 2 mul eq { exit } if
  2198.         pntArray index 3 -1 roll put
  2199.         /index index 1 add def
  2200.     } loop
  2201.  
  2202.     newpath 1 setlinewidth 0 setgray
  2203.     /index 0 def
  2204.     {
  2205.         index noOfPoints eq { exit } if
  2206.         pntArray index 2 mul 1 add get pntArray index 2 mul get
  2207. %        index noOfPoints 1 sub eq { pop pop lineConnect.h lineConnect.v } if
  2208.         index 0 eq { moveto }{ lineto } ifelse
  2209.         /index index 1 add def
  2210.     } loop
  2211.     stroke
  2212.     end
  2213. } def
  2214.  
  2215. newpath 1 setlinewidth
  2216. 0 setgray
  2217.